local dushi = fk.CreateSkill{
  name = "n_dushi",
  tags = { Skill.Compulsory, Skill.Combo },
}

Fk:loadTranslationTable{
  ["n_dushi"] = "蠹蚀",
  [":n_dushi"] = "锁定技，连招技（任意两张同名牌），当前回合角色弃置所有手牌，然后你摸一张牌。",
  ["@n_dushi"] = "蠹蚀",
}

local combo_mark = "@n_dushi"

dushi:addEffect(fk.CardUsing, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(dushi.name) and
      data.extra_data and data.extra_data.combo_skill and data.extra_data.combo_skill[dushi.name]
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player, combo_mark, 0)
    local current = room.current
    room:throwCard(current:getCardIds("h"), dushi.name, current, player)

    if not player.dead then
      player:drawCards(1, dushi.name)
    end
  end,
})

dushi:addEffect(fk.AfterCardUseDeclared, {
  can_refresh = function (self, event, target, player, data)
    return target == player and player:hasSkill(dushi.name, true)
  end,
  on_refresh = function (self, event, target, player, data)
    local room = player.room
    local name = data.card.trueName
    if player:getMark(combo_mark) == name then
      data.extra_data = data.extra_data or {}
      data.extra_data.combo_skill = data.extra_data.combo_skill or {}
      data.extra_data.combo_skill[dushi.name] = true
    else
      room:setPlayerMark(player, combo_mark, name)
    end
  end,
})

return dushi
